﻿Imports System.Data.OleDb
Imports DTO
Public Class ThamSoDAO
    Public Function CapNhatThamSo(ByVal sql As String) As Integer
        DataProvider.OpenConnecttion()
        Dim kq As Integer = DataProvider.ExecInsert(sql)
        DataProvider.CloseConnect()
        Return kq
    End Function

    Public Function LayThongtin() As ThamSoDTO
        DataProvider.OpenConnecttion()
        Dim reader As OleDbDataReader
        Dim sql As String = "select TuoiToiThieu,TuoiToiDa,ThoiHan,NamXuatBan,SoSachMuonToiDa,SoNgayMuonToiDa,TienPhatMotNgayTre "
        sql = sql & " from THAMSO"
        reader = DataProvider.ExecSelect(sql)
        Dim ts As New ThamSoDTO()

        While reader.Read()
            ts.TuoiToiThieu = reader.GetInt32(0)
            ts.TuoiToiDa = reader.GetInt32(1)
            ts.ThoiHanThe = reader.GetInt32(2)
            ts.NamXuatBan = reader.GetInt32(3)
            ts.SoLuongSachMuonToiDa = reader.GetInt32(4)
            ts.SoNgayMuonSachToiDa = reader.GetInt32(5)
            ts.TienPhat = reader.GetInt32(6)
        End While
        DataProvider.CloseConnect()
        Return ts
    End Function
End Class
